<?php
/**
 * @annotate 后台企业管理
 * @group   Admin/Haiyin
 * @author   yachtxiao <fuck@fackyou.org>
 */
class FaxianAction extends BaseAction {
	protected $aVerify = array(
   	'list'
  	);//需要验证的方法
	public function faxian_list(){
		$list = D('company_faxian')->order('ctime desc')->findpage(20);
		foreach ($list['data'] as $k => &$v) {
			$v['pic'] = get_img_url($v['pic']);
		}
		$this->assign('list',$list);
		$this->display();
	}
	public function list_nopass(){
		$list = D('company_faxian')->where('status = 0 AND is_del = 0')->order('ctime desc')->findpage(20);
		foreach ($list['data'] as $k => &$v) {
			$v['pic'] = get_img_url($v['pic']);
		}
		$this->assign('list',$list);
		$this->display();
	}
	public function  edit_faxian_status(){
		$map['fid'] = $_POST['id'];
		$data['status'] = $_POST['val'];
		$data['ctime'] = time();
		$da = D('company_faxian')->where($map)->save($data);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	public function  del_faxian(){
		$map['fid'] = $_POST['id'];
		$data['is_del'] = 1;
		$da = D('company_faxian')->where($map)->save($data);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	public function  edit_faxian_num(){
		$map['fid'] = $_POST['fid'];
		$data['check'] =  $_POST['check'];
		$data['share'] =  $_POST['share'];
		$da = D('company_faxian')->where($map)->save($data);
		if($da){
			$this->success('保存成功',"__URL__/faxian_list");
		}else{
			$this->error('修改失败',"__URL__/faxian_list");
		}
	}
}
?>